package com.kzj.controller;

import com.kzj.common.result.Result;
import com.kzj.pojo.dto.ChangePasswordDto;
import com.kzj.pojo.dto.LoginDto;
import com.kzj.pojo.dto.TeacherUpdateDto;
import com.kzj.service.TeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpSession;

@RestController
@RequestMapping("/teacher")
public class TeacherController {
    @Autowired
    TeacherService teacherService;
    @GetMapping
    public Result getInfo(HttpSession session)
    {
        return teacherService.getInfo(session);
    }
    @PutMapping
    public Result update(@RequestBody @Validated TeacherUpdateDto dto)
    {
        return teacherService.upate(dto);
    }
    @GetMapping("/all")
    public Result getAll()
    {
        return teacherService.getAll();
    }
    @PutMapping("/changePassword")
    public Result changePassword(@RequestBody ChangePasswordDto dto,HttpSession session)
    {
        return teacherService.changePassword(dto,session);
    }

}
